var date = function (time) {
    if (!time) {
        return ''
    }
    const dateTime = new Date(time);

    const year = dateTime.getFullYear();
    const month = dateTime.getMonth() + 1;
    const data = dateTime.getDate();

    function addZero(v) {
        return v < 10 ? '0' + v : v
    }
    return `${year}-${addZero(month)}-${addZero(data)}`
}

export default date